<template>
  <div class="other-system-box">
    <iframe
      :style="{'min-height':minHeight}"
      class="frame"
      v-bind:src="reportUrl"
      id="my-iframe"
    ></iframe>
  </div>
</template>
<script>
import Cookies from 'js-cookie'
import Setting from '@/setting'
import { mapActions } from 'vuex';

export default {
  data () {
    return {
      // minHeight: (document.body.clientWidth) > 1366 ? `${document.body.clientHeight + 56}px` : `${document.body.clientHeight}px`,
      minHeight: `${document.body.clientHeight - 118}px`,
      reportUrl: '',
    };
  },
  mounted () {
    console.log(Setting.TODO_CENTER_URL)
    this.setTimer()
  },
  methods: {
    ...mapActions('sourcing/demandInquery', [
      'eventRemindList' // 获取待办事项
    ]),
    // 获取uc_token
    setTimer () {
      const ucToken = Cookies.get().uc_token;
      let timer;
      if (!ucToken) {
        timer = setTimeout(() => {
          this.setTimer();
        }, 1000);
      } else {
        this.reportUrl = `${Setting.TODO_CENTER_URL}?uc_token=${ucToken}&systemName=PC`;
        // this.getSourcingRemindList()
        clearTimeout(timer);
      }
    },
    // 获取寻源待办
    getSourcingRemindList () {
      const data = {};
      this.eventRemindList({
        payload: {
          data
        }
      });
    },
  }
};
</script>
<style lang="less">
.frame{
  width: 100%;
  height: 100%;
}
iframe {
  border-width: 2px;
  border-style: inset;
  border-color: initial;
  border-image: initial;
  border-top-width: 0px;
  border-right-width: 0px;
  border-bottom-width: 0px;
  border-left-width: 0px;
}
</style>
